def groupAnagrams(strs):
    if not strs:
        return [[""]]
    keys = set(["".join(sorted(j)) for j in strs])
    wmap = {}
    # for i in wmap:
    #     wmap[i] = []
    # print(wmap)
    ret_map = {}
    for i in strs:
        s = "".join(sorted(i))
        if s in ret_map:
            ret_map[s].append(i)
        else:
            ret_map[s] = [i]
    print(ret_map)
    print([ret_map[i] for i in ret_map])
    return ([ret_map[i] for i in ret_map])


strs = ["eat", "tea", "tan", "ate", "nat", "bat"]

groupAnagrams(strs)
